//
//  SelfTabBarController.swift
//  DianShangWen
//
//  Created by 周文轩 on 15/3/31.
//  Copyright (c) 2015年 &#21608;&#25991;&#36713;. All rights reserved.
//

import UIKit

class SelfTabBarController: UITabBarController {

    let tabBarViewArray: [(String, String, String)] = [
        ("Reply", "ReplyNavigation", "问答"),
        ("Curriculum", "CurriculumNavigation", "课程"),
        ("Find", "FindNavigation", "发现"),
        ("Self", "SelfNavigation", "我")
    ]
    
    override func viewDidLoad() {
        super.viewDidLoad()
        dianShangWentabBar()
        
        // Do any additional setup after loading the view.
    }
    
    func dianShangWentabBar() {
        tabBar.tintColor = ResourceProvider.sharedInstance.greenColoer
        
        let lwhViewControllers = map(tabBarViewArray) {(storyBoardName, viewControllerIdentifier, tabName) -> UIViewController in
            let itemStoryBoard: UIStoryboard = UIStoryboard(name: storyBoardName, bundle: nil)
            let initialViewController: UIViewController = itemStoryBoard.instantiateViewControllerWithIdentifier(viewControllerIdentifier)as! UIViewController
            initialViewController.tabBarItem.title = tabName
            initialViewController.tabBarItem.image = UIImage(named: storyBoardName)
            initialViewController.tabBarItem.selectedImage = UIImage(named: "\(storyBoardName)_green")
            
            return initialViewController
        }
        
        viewControllers = lwhViewControllers
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
